package week1;

import java.util.Scanner;

public class Ex8 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = "";
        for (int i = 0; i < 20; ++i){
            str += sc.next();
        }
        long maxnum = 0;
        for (int i = 0; i < str.length() - 12; ++i){
            long num = 1L;
            for (int j = 0; j <= 12; ++j){
                num *= (str.charAt(i + j) - '0');
            }
            if (num > maxnum)
                maxnum = num;
        }
        System.out.println(maxnum);
    }
}
